package com.jiayuan.cn.energy.config;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import java.util.Map;

@Component
@Getter
@Setter
@Validated // 校验
@Configuration
@ConfigurationProperties(prefix = "app")
public class AppConfig {

    // # 循环时间(ms)
    private String rate;
    private int port;
    private WatchIp watchIp = new WatchIp();
    private DomainDns domainDns = new DomainDns();

    @NoArgsConstructor
    @AllArgsConstructor
    @Getter
    @Setter
    public static class WatchIp {
        // 解析类
        private String watchClass;
        // 公共参数
        private Map<String, String> watchArgs;
    }

    @NoArgsConstructor
    @AllArgsConstructor
    @Getter
    @Setter
    public static class DomainDns {
        // 解析到公网域名IP的类
        private String dnsClass;
        // 域名运营商关键信息
        private Map<String, String> dnsArgs;
    }

}